using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum BattleType
{
    NullTrans = -1,
    Begin = 0,
    Battle =1,
    End = 2,
    Max =99

}

public class BattleStateControl
{

    private Dictionary<BattleType, BattleStateBase> stateDic = new Dictionary<BattleType, BattleStateBase>();

    private BattleStateBase m_CurrState;
    public BattleStateControl()
    { }


    public void AddState(BattleStateBase state)
    {
        if (!stateDic.ContainsKey(state.battleType))
            stateDic.Add(state.battleType, state);
        if (m_CurrState == null)
        {
            m_CurrState = state;
        }

    }

    public BattleStateBase GetState(BattleType battleType)
    {
        return stateDic[battleType];
    }

    public void SetState(BattleType battleType)
    {
        if (m_CurrState != null)
            m_CurrState.Relese();

        m_CurrState = GetState(battleType);
        m_CurrState.Init();
    }
    public void Init()
    {
        m_CurrState.Init();
    }
    public void Update()
    {
        m_CurrState.Update();
    }
    public void Release ()
    {
        m_CurrState.Relese();
    }
}
